package cn.ynrcb.personnelfile.common.utils;

import cn.ynrcb.personnelfile.admin.enums.CodeEnum;

public class EnumUtil {
    //返回的对象实现CodeEnum接口
    public static <T extends CodeEnum> T getByCode(Class<T> enumClass, Integer code) {
        for (T each : enumClass.getEnumConstants()) {
            if(each.getCode() - (code) == 0){
                return each;
            }
        }
        return null;
    }
}
